<?php
/*
 * 自动加载model
 *
 */
function loadModel()
{
    $dirs = array('');
    $url_maps = array();
    while (!empty($dirs)) {
        $current = array_pop($dirs);
        if ($handle = opendir(CONFIG["app"]["model_path"] . '/' . $current)) {
            while (false !== ($file = readdir($handle))) {
                if ($file == "." || $file == "..")
                    continue;
                if (is_dir(CONFIG["app"]["model_path"] . '/' . $current . '/' . $file)) {
                    array_push($dirs, $current . '/' . $file);
                } else {
                    if (is_file(CONFIG["app"]["model_path"] . '/' . $current . '/' . $file) && strpos($file, ".php") > 0) {
                        require_once CONFIG["app"]["model_path"] . "$current/$file";
                    }
                }
            }
        }
    }
    return $url_maps;
}
